# -*- coding:utf-8 -*-
from functools import cmp_to_key
class Solution:
    def PrintMinNumber(self, n):
        # write code here
        if n==None or len(n)==0:
            return ''
        a = []
        for i in n:
            a.append(str(i))
        key = cmp_to_key(lambda x,y: int(x+y)-int(y+x))
        a.sort(key=key)
        return ''.join(a)



a = [3,32,321]
s=Solution()
print(s.PrintMinNumber(a))